package com.zhiyou100.listener;

import javax.servlet.ServletRequest;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class VisitListener implements ServletRequestListener{

	@Override
	public void requestDestroyed(ServletRequestEvent sre) {
//		System.out.println("统计结束");
		
	}

	@Override
	public void requestInitialized(ServletRequestEvent sre) {
//		ServletRequest sr = sre.getServletRequest();
//		HttpServletRequest request = (HttpServletRequest)sr;
//		HttpSession session = request.getSession();
//		Object o = session.getAttribute("visitCount");
//		if(o==null) {
//			session.setAttribute("visitCount", new Integer(1));
//		}else {
//			Integer i = (Integer) o;
//			session.setAttribute("visitCount", new Integer(i.intValue()+1));
//		}
	}

}
